<div class="m-2">

    <div class="d-block mt-2">
        <i class="fa fa-eye mr-1"></i><label class="title mr-2">{{summary.title}}的任务</label>

        <div style="font-size: 0.8em; display: inline;">
            <label class="mr-1">按指派人员筛选</label>
        
            <select class="d-inline form-controll mr-4" onchange="return filter_task_by_assigned(this);">
                <option value="-1">-- 全部 --</option>
                {% for name, id in pairs(all_assigned) do %}
                <option value="{{id}}">{{name}}</option>
                {% end %}
            </select> 
        </div>
        
        <div class="pull-right mr-2">
            <div class="d-inline btn-link" onclick="return switch_viewmode();">
                {% if session.gantt_mode then %}
                <i class="fa fa-id-badge mr-1"></i>看板
                {% else %}
                <i class="fa fa-sliders mr-1"></i>甘特图
                {% end %}
            </div>
        </div>
    </div>

    <hr class="m-0">

    <div class="container mw-100 mt-2">
        {[ session.gantt_mode and "dashboard/tasks/mode_gantt.html" or "dashboard/tasks/mode_normal.html" ]}
    </div>
</div>

<div id="task-view" class="task-view-pane invisible">
    <div id="task-info-pane">
    </div>
</div>

<script type='text/javascript'>
var task_info_changed = false;

function open_task(tid, changed) {
    if (changed) task_info_changed = true;

    $('#task-info-pane').empty();
    $('#task-info-pane').get(0).innerHTML = '<div class="text-center text-muted" style="margin-top: 40%"><i class="fa fa-spinner fa-spin fa-3x fa-fw"></i></div>';
    $('#task-view').removeClass('invisible');
    $('#task-view').addClass('visible');

    $.post("{*readonly and '/dashboard/tasks/readonly_info' or '/dashboard/tasks/info'*}", {id : tid}, function(ret) {
        $('#task-info-pane').empty();
        $('#task-info-pane').append($(ret));
    }, 'html');
}

function close_task(force_refresh) {
    $('#task-view').removeClass('visible');
    $('#task-view').addClass('invisible');

    if (force_refresh || (last_filter_menu && task_info_changed)) last_filter_menu.click();
}

function switch_viewmode() {
    $.post('/dashboard/tasks/switch_viewmode', function(ret) { last_filter_menu.click(); }, 'json');
}
</script>